module.exports = function () {
  return {
    visitor: {
      /* CallExpression(path) {
        const { node } = path;
        if (
          node.callee.object && 
          node.callee.object.name === 'console' &&
          node.callee.property &&
          (node.callee.property.name === 'log' || 
           node.callee.property.name === 'warn' ||
           node.callee.property.name === 'error' ||
           node.callee.property.name === 'info')
        ) {
          path.remove();
          console.log(`Removed console.${node.callee.property.name} at ${path.hub.file.opts.filename}:${node.loc.start.line}`);
        }
      }, */
      CallExpression(path) {
        const { node } = path;
        if (
          node.callee.object &&
          node.callee.object.name === "console" &&
          node.callee.property &&
          node.callee.property.name === "log"
        ) {
          path.remove();
          console.log(
            `Removed console.${node.callee.property.name} at ${path.hub.file.opts.filename}:${node.loc.start.line}`
          );
        }
      },
      Identifier(path) {
        if (
          path.node.name === "console" &&
          path.parentPath.isMemberExpression()
        ) {
          path.parentPath.remove();
          console.log(
            `Removed console reference at ${path.hub.file.opts.filename}:${path.node.loc.start.line}`
          );
        }
      },
    },
  };
};
